package com.clinic.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;

@Entity
@PrimaryKeyJoinColumn(name = "cg_obj_id")
public class Clinic_config extends Super_type {

	private static final long serialVersionUID = 1L;

	@Column(insertable = false, updatable = false)
	private int cg_obj_id;
	@Column(length = 1024)
	private String time_period;
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "cc_obj_id", nullable = false)
	private Clinic clinic;
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "dr_obj_id", nullable = false)
	private Doctor doctor;

	public Clinic_config() {
		super();
	}

	public Clinic_config(String obj_owner_name, String time_period) {
		super(obj_owner_name);
		this.time_period = time_period;
	}

	public Clinic_config(String obj_owner_name, String time_period,
			Clinic clinic, Doctor doctor) {
		super(obj_owner_name);
		this.time_period = time_period;
		this.clinic = clinic;
		this.doctor = doctor;
	}

	public String getTime_period() {
		return time_period;
	}

	public void setTime_period(String time_period) {
		this.time_period = time_period;
	}

	public Clinic getClinic() {
		return clinic;
	}

	public void setClinic(Clinic clinic) {
		this.clinic = clinic;
	}

	public Doctor getDoctor() {
		return doctor;
	}

	public void setDoctor(Doctor doctor) {
		this.doctor = doctor;
	}

	public int getCg_obj_id() {
		return cg_obj_id;
	}

	@Override
	public void _toString() {
		System.out.println("Enter - _toString");
		super._toString();
		System.out.println("time_period : " + this.time_period
				+ "\nclinic ID: " + clinic.getCc_obj_id() + "\ndoctor ID: "
				+ doctor.getDr_obj_id());
		System.out.println("Exit - _toString");
	}
}